<template>
  <div class="app-container sun-hetong">
    <el-page-header content="焊道管理" @back="goBack" />
    <wise-crud ref="wise-crud" :urls="urls" :fields="fields" :filters="filters" :handle="handle"/>
  </div>
</template>

<script>
import WiseCrud from '@/components/Crud/wiseCrud'
export default {
  name: 'WeldInfoManage',
  components: { WiseCrud },
  props: {
    craftsId: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      urls: {
        list: '/api/v1/welder-sbtx-second/weld-info-comb/getList',
        add: '/api/v1/welder-sbtx-second/weld-info-comb/create',
        show: '/api/v1/welder-sbtx-second/weld-info/show/',
        update: '/api/v1/welder-sbtx-second/weld-info-comb/update/',
        delete: '/api/v1/welder-sbtx-second/weld-info/remove/'
      },
      fields: [
        { label: '序号', type: 'index', use: ['table'] },
        {
          label: '焊道名称',
          prop: 'weldName',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊道名称', trigger: 'blur' }
          ],
          placeholder: '请输入焊道名称',
          use: ['table', 'add', 'view', 'edit', 'delete']
        }, {
          label: '焊接方法',
          prop: 'weldMethod',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊接方法', trigger: 'blur' }
          ],
          placeholder: '请输入焊接方法',
          use: ['table', 'add', 'view', 'edit', 'delete']
        }, {
          label: '焊材型号',
          prop: 'model',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊材型号', trigger: 'blur' }
          ],
          placeholder: '请输入焊材型号',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '焊材规格',
          prop: 'specification',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊材规格', trigger: 'blur' }
          ],
          placeholder: '请输入焊材规格',
          use: ['table', 'add', 'view', 'edit', 'delete']
        }, {
          label: '管材型号',
          prop: 'model1',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊材型号', trigger: 'blur' }
          ],
          placeholder: '请输入焊材型号',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '管材规格',
          prop: 'specification1',
          type: 'text',
          maxlength: 40,
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊材规格', trigger: 'blur' }
          ],
          placeholder: '请输入焊材规格',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最小电流',
          prop: 'electricCurrentMin',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最小电流', trigger: 'blur' }
          ],
          placeholder: '请输入最小电流',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最大电流',
          prop: 'electricCurrentMax',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最大电流', trigger: 'blur' }
          ],
          placeholder: '请输入最大电流',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最小电压',
          prop: 'voltageMin',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最小电压', trigger: 'blur' }
          ],
          placeholder: '请输入最小电压',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最大电压',
          prop: 'voltageMax',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最大电压', trigger: 'blur' }
          ],
          placeholder: '请输入最大电压',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最小焊接速度',
          prop: 'weldingSpeedMin',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最小焊接速度', trigger: 'blur' }
          ],
          placeholder: '请输入最小焊接速度',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最大焊接速度',
          prop: 'weldingSpeedMax',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最大焊接速度', trigger: 'blur' }
          ],
          placeholder: '请输入最大焊接速度',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最小焊接热输入',
          prop: 'weldingHeatInputMin',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最小焊接热输入', trigger: 'blur' }
          ],
          placeholder: '请输入最小焊接热输入',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '最大焊接热输入',
          prop: 'weldingHeatInputMax',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入最大焊接热输入', trigger: 'blur' }
          ],
          placeholder: '请输入最大焊接热输入',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '焊层编号',
          prop: 'weldingLayerNumber',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊层编号', trigger: 'blur' }
          ],
          placeholder: '请输入焊层编号',
          use: ['table', 'add', 'view', 'edit', 'delete']
        },
        {
          label: '顺序',
          prop: 'sort',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入焊层编号', trigger: 'blur' }
          ],
          placeholder: '请输入焊层编号',
          use: ['add', 'view', 'edit', 'delete']
        },
        {
          prop: 'craftsId',
          defaultValue: this.craftsId,
          use: ['add', 'edit']
        },
        { label: '操作', type: 'handle', use: ['table'], handle: ['view', 'edit', 'delete'], tableWidth: 260 }
      ]
    }
  },
  computed: {
    handle() {
      if (this.$store.state.user.project) {
        return []
      } else {
        return ['add']
      }
    },
    filters() {
      return [{ field: 'craftsId', operator: 'EQUALS', value: this.craftsId }]
    }
  },
  methods: {
    goBack() {
      this.$emit('back')
    }
  }
}
</script>

<style scoped>

</style>
